package com.example.apptest;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    private DrawerLayout mainDl;
    private Toolbar mainToolbar;
    private ViewPager mainVp;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        init();

        //TODO:标题
        mainToolbar.setTitle("");
        setSupportActionBar(mainToolbar);

        //抽屉
        ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this,mainDl,mainToolbar,R.string.app_name,R.string.app_name);
        mainDl.addDrawerListener(actionBarDrawerToggle);
        actionBarDrawerToggle.syncState();
    }

    public void init(){
        mainDl = (DrawerLayout) findViewById(R.id.main_dl);
        mainToolbar = (Toolbar) findViewById(R.id.main_toolbar);
        mainVp = (ViewPager) findViewById(R.id.main_vp);
    }
}